package com.example.mvpdemo.retrofit;

import com.example.mvpdemo.base.BaseModel;
import com.example.mvpdemo.base.BaseResult;
import com.example.mvpdemo.bean.LoginBean;
import com.example.mvpdemo.bean.UserInfoBean;

import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * @author:created by njb
 * 时间:2019/3/8 15 04
 * 描述:
 */
public interface ApiServer {
    @GET("/article/list/1/json")
    Observable<BaseModel> getArtList(@QueryMap Map<String,String>map);



    /**
     * 登录
     */
    @POST("user/login")
    Observable<LoginBean> login(@Body RequestBody body);

    /**
     * 注册
     */
    @FormUrlEncoded
    Observable<BaseResult> register(@Field("countryCode")String countryCode, @Field("countryName")String countryName
            , @Field("userPhone")String userPhone , @Field("password") String password, @Field("deviceType") String deviceType,
                                    @Field("smsCode")String smsCode);

    /**
     * 短信验证
     */
    @GET("user/getSmsCode")
    Observable<BaseResult> getSmsCode(@Query("countryCode") String countryCode, @Query("userPhone") String userPhone,
                                      @Query("type") String type);

    /**
     * 短信验证
     */
    @GET("user/info")
    Observable<UserInfoBean> getUserInfo();

    /**
     * 获取token
     */
    @GET("user/info")
    Observable<BaseResult> getInfo(@Query("token")String token);


    /**
     * 修改密码
     */
    @POST("user/password/reset")
    Observable<BaseResult> getResetPsw(@Body RequestBody body);

    /**
     * 头像上传
     */
    @POST("uploadFile")
    Observable<BaseResult> getUploadFile(@Body MultipartBody body);

    /**
     * 修改密码
     */
    @POST("user/password/update")
    Observable<BaseResult> getPasswordUpdate(@Body RequestBody body);

    @PUT("center/user/avatar")
    Observable<BaseResult> getAvatar(@Body RequestBody body);

    @POST("/api/v1/zero/user/feedback/uploadLog")
    @Multipart
    Call<HttpResult<String>> uploadLog(@Part List<MultipartBody.Part> file);


}
